﻿using System;
using Transformable_Engine_v2.Engine.Animation.FrameAnimation;

namespace Super_Management_Mayhem.Screens.Playing.Players.Manager
{
    partial class Manager
    {
        private void HandleKeyPressIdleState(Input input)
        {
            switch (input)
            {
                case Input.Down:
                case Input.Left:
                case Input.Right:
                case Input.Up:
                    ChangeState(PlayerState.Walk);
                    break;
                case Input.Attack:
                    ChangeState(PlayerState.Attack);
                    break;
            }
        }

        private void HandleKeyReleaseIdleState(Input input) {}

        private void InitializeIdleState()
        {
            _character.ClearAnimation<FrameAnimation>();

            _currentDirection = Direction.None;
            if(_isCarrying)
            {
                SetIdleCarryModel(_latestDirection);
            }
            else
            {
                SetIdleModel(_latestDirection);
            }

            
        }

        private void UpdateIdleState(TimeSpan gameTime)
        {
            if(!Playscreen.Controller.IsStarted)
                return;

            if (_input.UpKeyState || _input.DownKeyState || _input.LeftKeyState || _input.RightKeyState)
            {
                ChangeState(PlayerState.Walk);
            }
        }
    }
}
